//
//  OrderPostHeadCell.swift
//  旅航ios
//
//  Created by tulip on 2021/5/7.
//

import UIKit
import SwiftyJSON
class OrderPostHeadCell: UITableViewCell {
    
    var infoArr:[JSON]?
    @IBOutlet weak var tip: UIButton!
    @IBOutlet weak var title: UILabel!
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        self.backgroundColor=UIColor.white
        self.selectionStyle = .none
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        
        // Configure the view for the selected state
    }
    
    @IBAction func showDetails(_ sender: Any) {
        let view=HangbanView.init(frame: CGRect(x: 0, y: 0, width: SCREEN_WIDTH, height: SCREEN_HEIGHT))
        view.isWangFan=false
      
        view.setUI(infoArr: infoArr ?? [])
        getKeyWindow()?.addSubview(view)
        
    }
    
    func setInfo(arr:[JSON]){
        let dptCity=arr[0]["dptCity"].string ?? ""
        let arrCity=arr[0]["arrCity"].string ?? ""
        let dptDate=arr[0]["dptDate"].string ?? ""
        let dptTime=arr[0]["dptTime"].string ?? ""
        
        let arf=arr[0]["arf"].string ?? "0"
        let tof=arr[0]["tof"].string ?? "0"
        
        title.text=dptCity + "-" + arrCity + " " + dptDate + " " + dptTime
        let fu = Int(arf)!  + Int(tof)!
        let fustr="机建燃油费￥" + String(fu)
        tip.setTitle(fustr, for: .normal)
    }
    
}
